<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">

        <div @click='fatherHandler' class="box">

            <!--  事件修饰符 阻止事件冒泡 -->
            <button @click.stop='handler2'> 第二种方式 </button>


            <a href="http://www.baidu.com" @click.prevent='go'> 百度</a>




        </div>

        <input type="text" @keyup.enter='submit'>



        <input type="text" @keyup.delete.esc='submit2' v-model='msg'>

        

    </div>
    <script src="./vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: '我是默认的值'
            },
            methods: {


                handler2() {
                    alert('handler2')
                },
                fatherHandler() {
                    alert('fatherHandler')

                },
                go() {
                    alert('百度')
                },
                submit() {
                    alert("提交")
                },
                submit2() {
                    this.msg = ''
                }
            }
        });
    </script>
</body>

</html>